package cn.circle.dou;



public class Main {

	static void testList(DoubleLinkedList<Integer> list) {
		list.add(11);
		list.add(22);
		list.add(33);
		list.add(44);

		list.add(0, 55); // [55, 11, 22, 33, 44]
		list.add(2, 66); // [55, 11, 66, 22, 33, 44]
		list.add(list.size(), 77); // [55, 11, 66, 22, 33, 44, 77]

		list.remove(0); // [11, 66, 22, 33, 44, 77]
		list.remove(2); // [11, 66, 33, 44, 77]
		list.remove(list.size() - 1); // [11, 66, 33, 44]

		//Asserts.test(list.indexOf(44) == 3);
		//Asserts.test(list.indexOf(22) == -1);
		//Asserts.test(list.contains(33));
		//Asserts.test(list.get(0) == 11);
		//Asserts.test(list.get(1) == 66);
		//Asserts.test(list.get(list.size() - 1) == 44);

		System.out.println(list);
	}
	


	public static void main(String[] args) {
		DoubleLinkedList<Integer> linkedList = new DoubleLinkedList<>();
		//System.out.println(linkedList.size());
		linkedList.add(1);


		System.out.println(linkedList);

		linkedList.add(2);
		linkedList.add(3);
		linkedList.add(4);// 1 2 3 4
		System.out.println(linkedList);

		linkedList.add(4,11); // 1 2 3 4 11
		linkedList.add(3,22); // 1 2 3 22 4 11
		System.out.println(linkedList);

		//System.out.println("******************");
		//System.out.println(linkedList.size());
		//testList(new LinkedList<Integer>());
		//testList(new LinkedList<Integer>());
		
		
		 //testList(new SingleLinkedList<>());
		
		// testList(new CircleLinkedList<>());
		
		/*
		 * gc root对象
		 * 1> 被局部变量指向的对象
		 */
	}

}
